package com.cmxh.cloundnote.config;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

@Component
public class LuanMaFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤器");
        //前读如果发送的是post的请求而且请求中有乱码
        //我们把前端发送回来的请求中文字使用utf-8进行重新编码
       servletRequest.setCharacterEncoding("utf-8");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
